<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .bg{
            background-image: url(jdms.png);
            background-repeat: no-repeat;
            margin: auto;
            width: 240px;
            height: 330px;

        }
        .t{
            color: white;
            padding-left: 35px;
            padding-top: 25px;
            font-size: 30px;

        }
        .t1{
            color: white;
            padding-top: 100px;
            padding-left:  30px; ;
        }
        .hour{

            background-color: black;
            color: white;
            width: 35px;
            height: 35px;
            margin-top: 10px;
            margin-left: 25px;
            float: left;

        }
        .minute{
            background-color: black;
            color: white;
            width: 35px;
            height: 35px;
            margin-top: 10px;
            margin-left: 10px;
            float: left;

        }
        .second{
            background-color: black;
            color: white;
            width: 35px;
            height: 35px;
            margin-top: 10px;
            margin-left: 10px;
            float: left;


        }
        .h{
            margin-top: 10px;
            margin-left: 5px;
            float: left;
            font-size: 20px;
            color: white;
        }


    </style>
</head>
<body>
    <div class="bg">
    <div class="t">京东秒杀</div>
    <div class="t1">10:00点场倒计时</div>
    <div  class="hour"></div>
    <span class="h">
:
    </span>
    <div class="minute"></div>
    <span class="h">
        :
            </span>
    <div class="second"></div></div>
    <script>
        var hour=document.querySelector('.hour');
        var minute=document.querySelector('.minute');
        var second=document.querySelector('.second');
        var inputTime=+new Date('2021-6-6 24:00:00');
        countDown();
        setInterval(countDown,1000);
        function countDown(){
            var nowTime=+new Date();
            var times =(inputTime-nowTime)/1000;
            var h=parseInt(times/60/60%24);
            h=h<10?'0'+h:h;
            hour.innerHTML=h;
            var m =parseInt(times/60%60);
            m=m<10?'0'+m:m;
            minute.innerHTML=m;
            var  s=parseInt(times%60);
            s=s<10?'0'+s:s;
            second.innerHTML=s;
        }
    </script>
</body>
</html>